/**
 * 
 */
package de.cbf.cam.dsa.model.prerequisites;

import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;

import de.cbf.cam.dsa.model.entities.BattleChar;
import de.cbf.cam.dsa.model.entities.OneNPC;

/**
 * @author Nebelritter
 *
 */
@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
public class AttributePrereq extends Prereq {

	/**
	 * @uml.property  name="attributeName"
	 */
	protected String attributeName;
	/**
	 * @uml.property  name="value"
	 */
	protected int value;
	
	/**
	 * 
	 */
	public AttributePrereq(String attributeName,int value) {
		this.attributeName	= attributeName;
		this.value			= value;
	}

	@Override
	public boolean characterMeetsPrereq(BattleChar character) {
		return characterMeetsPrereq(character.getCharacter());
	}
	@Override
	public boolean characterMeetsPrereq(OneNPC character) {
		if (character.getAttribute(attributeName).getCurrentValue()>=value) {
			return true;			
		}else{
			return false;
		}		
	}

	/**
	 * @return
	 * @uml.property  name="attributeName"
	 */
	public String getAttributeName() {
		return attributeName;
	}

	/**
	 * @param attributeName
	 * @uml.property  name="attributeName"
	 */
	public void setAttributeName(String attributeName) {
		this.attributeName = attributeName;
	}

	/**
	 * @return
	 * @uml.property  name="value"
	 */
	public int getValue() {
		return value;
	}

	/**
	 * @param value
	 * @uml.property  name="value"
	 */
	public void setValue(int value) {
		this.value = value;
	}

	
}
